package com.cn.thread;

/**
 * @author hels
 * @version 1.0
 * @date 2022/3/8 10:23
 * 匿名内部类，执行完之后才会执行后边的功能；
 */
public class T3Anonymity {
    public static void main(String[] args) {



        for (int i = 0; i < 10; i++) {
            System.out.println(Thread.currentThread().getName() + "%" + i);

            if (i == 2) {
                new Thread("线程一"){
                    @Override
                    public void run() {
                        for (int i = 0; i < 10; i++) {
                            System.out.println(Thread.currentThread().getName() + "-" + i);
                        }
                    }
                }.start();
            }

        }

        Runnable r = new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 10; i++) {
                    System.out.println(Thread.currentThread().getName() + "%" + i);
                }
            }
        };
        new Thread(r, "高达").start();

    }
}
